Class WebmasterTools::Sitemaps::IndexNode
In: lib/webmaster_tools/sitemaps.rb
Parent: Object

This IndexNode is the object that represents a single row in the sitemap index file. You can create your own classes, and as long as they have a to_sitemap_index_node method they can be used as part of the sitemap index file

Methods

new   to_xml  

Attributes

host  [RW] 
lastmod  [RW] 
path  [RW] 
protocol  [RW] 

Public Class methods

[Source]

    # File lib/webmaster_tools/sitemaps.rb, line 71
71:       def initialize(options)
72:         [:protocol, :host, :path, :lastmod].each do |field|
73:           self.send("#{field}=",options[field])
74:         end
75:       end

Public Instance methods

Returns an xml representation of the IndexNode that conforms to xml sitemap index elements

[Source]

    # File lib/webmaster_tools/sitemaps.rb, line 79
79:       def to_xml(options = {})
80:         options[:indent] ||= 2
81:         xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
82:         xml.instruct! unless options[:skip_instruct]
83:         xml.sitemap do
84:           xml.tag!(:loc, "#{protocol || options[:protocol]}#{host || options[:host]}#{path}")
85:           xml.tag!(:lastmod, lastmod.xmlschema) if lastmod.respond_to?(:xmlschema)
86:         end
87:       end

[Validate]